#ifndef __IMITAB_H__
#define __IMITAB_H__
#include "cocos2d.h"
#include "IMIButton.h"
#include <vector>
#include <string>
using std::vector;
using std::string;
USING_NS_CC;
//this,IMI_TouchHandler(&Setting::tabHandler)
typedef void (CCObject::*IMI_TouchHandler)(int tabIndex);
#define imi_touch_selector(_SELECTOR) (IMI_TouchHandler)(&_SELECTOR)
class IMITab:public CCObject
{
public:
	IMITab();
	~IMITab(){};

	CCObject*			m_iTouchBeganListener;
	IMI_TouchHandler	m_ifnTouchBeganSelector;

	void addButton(IMIButton * imiButton);
	void setTab(int tabIndex);
	int getTab();
	void onTabEvent(CCObject *target, IMI_TouchHandler selector);
	
private:
	vector<IMIButton * > m_tab;
	int preIndex;
	bool isInternal;
	int currentIndex;
	void callBack();
	virtual void changeTab(CCObject* object, CCTouch *pTouch, CCEvent *pEvent);
};
#endif // !__IMITAB_H__
